<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>CIM管理系统</title>

<link charset="utf-8" rel="stylesheet" href="${pageContext.request.contextPath}/resource/bootstrap-3.3.6-dist/css/bootstrap.min.css"></link>
<link charset="utf-8" rel="stylesheet" href="${pageContext.request.contextPath}/resource/css/base-ui.css"></link>
<script type="text/javascript" src="${pageContext.request.contextPath}/resource/js/jquery-2.2.3.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resource/bootstrap-3.3.6-dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resource/js/framework.js"></script>
<script type="text/javascript">
function showMessageDialog(account) {
	doShowDialog("messageDialog");
	$('#Saccount').val(account);  
}
function doSendMessage() {
    var message = $('#message').val();
    var account = $('#Saccount').val();
    if ($.trim(message)=='') {
       return;
    }
    showProcess('正在发送，请稍后......');
    $.post("${pageContext.request.contextPath}/cgi/message_send.action", {
    		content: message,
    		type: 2,
    		sender: 'system',
    		receiver: account
    	}, function(data){
	      	hideProcess();
	      	showSTip("发送成功");
	      	doHideDialog("messageDialog");
     	});
}

function openWebclient() {
	if (false) {
		window.open("${pageContext.request.contextPath}/console/webclient/main.jsp", 
				"",
				"height="+800+", width="+600+", top=0, left=0, toolbar=no,menubar=no, scrollbars=no, resizable=no,location=no, status=no");
	} else {
		window.open("${pageContext.request.contextPath}/console/push/index.jsp", 
				"_blank");
	}
}
</script>
</head>
<body class="web-app ui-selectable">
<%@include file="../header.jsp"%>
<%@include file="../nav.jsp"%>
<div id="mainWrapper">
<div class="lay-main-toolbar"></div>
<div>
<table style="width: 100%" class="utable">
<thead>
<tr class="tableHeader">
    <th width="4%">头像</th>
	<th width="15%">账号</th>
	<th width="10%">终端</th>
	<th width="10%">终端版本</th>
	<th width="10%">应用版本</th>
	<th width="10%">设备型号</th>
	<th width="10%">在线时长</th>
	<th width="28%">令牌</th>
	<th width="12%">操作</th>
</tr>
</thead>
<tbody id="checkPlanList">
<c:forEach var="ios" items="${sessionList}">
	<tr id="${ios.token}" style=" height: 50px;">
    <td><img width="40px" height="40px" src="${pageContext.request.contextPath}/resource/img/icon.png"/></td>
	<td>
		<c:choose>
		<c:when test="${ios.alive == 1}">
		<span style="color:green;font-weight:bold;">${ios.username}</span>
		</c:when>
		<c:otherwise>
		<span style="color:red;font-weight:bold;">${ios.username}</span>
		</c:otherwise>
		</c:choose>
	</td>
	<td>-</td>
	<td>-</td>
	<td>-</td>
	<td>-</td>
	<td>${ios.bindTime2}秒</td>
	<td>
		<c:choose>
		<c:when test="${ios.alive == 1}">
		<span style="color:green;font-weight:bold;">${ios.token}</span>
		</c:when>
		<c:otherwise>
		<span style="color:red;font-weight:bold;">${ios.token}</span>
		</c:otherwise>
		</c:choose>
	</td>
	<td><div class="btn-group btn-group-xs">
		<button type="button" class="btn btn-primary" style="padding: 5px;" onclick="showMessageDialog('${ios.token}')">
			<span class="glyphicon glyphicon-send" style="top:2px;"></span>  发送消息
		</button>
	</div></td>
	</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
			
			
<div class="modal fade" id="messageDialog" tabindex="-1" role="dialog" >
<div class="modal-dialog" style="width: 420px;">
	<div class="modal-content">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title">发送消息</h4>
		</div>
		<div class="modal-body">
			<div class="form-groupBuy">
					<label for="Amobile">
						接收账号:
					</label>
					<input type="text" class="form-control" id="Saccount"
						name="account"
						style="width: 100%; font-size: 20px; font-weight: bold;height:40px;"
						disabled="disabled" />
				</div>
				<div class="form-groupBuy" style="margin-top: 20px;">
					<label for="exampleInputFile">
						消息内容:
					</label>
					<textarea rows="10" style="width: 100%; height: 200px;"
						id="message" name="message" class="form-control"></textarea>
				</div>
		</div>
		<div class="modal-footer" style="padding: 5px 10px; text-align: center;">
			<button type="button" class="btn btn-success btn-lg" style="width: 200px;" onclick="doSendMessage()">
				<span class="glyphicon glyphicon-send" style="top:2px;"></span> 发送
			</button>
		</div>
	</div>
</div>
</div>

<script>
$('#sessionMenu').addClass('current');		       
</script>

</body>
</html>
